package com.szy.douyou_gateway.client;

import com.szy.douyou_comment.dao.Comment;
import com.szy.douyou_comment.dao.CommentReq;
import com.szy.douyou_gateway.config.ResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 调用评论微服务
 * @author sunziyan
 * @date 2022/5/12
 */
@Component
@FeignClient("nacos-douyou-comment")
public interface CommentClient {

    /**
     * 调用接口分页查询该文章下所有评论
     * @param articleId
     * @return
     */
    @GetMapping("/comment/queryAllByArticle/{articleId}")
    ResultDTO queryAllByArticle(@PathVariable("articleId") Long articleId);

    /**
     * 调用接口添加一条评论
     * @param comment
     * @return
     */
    @PostMapping("/comment/addOne")
    ResultDTO addOne(@RequestBody Comment comment);

    /**
     * 调用接口分页查询所有评论
     * @param commentReq
     * @return
     */
    @PostMapping("/comment/queryAll")
    ResultDTO queryAll(@RequestBody CommentReq commentReq);

    /**
     * 调用接口删除一条评论
     * @param commentId
     * @return
     */
    @GetMapping("/comment/deleteOne/{commentId}")
    ResultDTO deleteOne(@PathVariable("commentId")Long commentId);
}
